<?php include THEMES_PATH.'public/before_body2.phtml'; ?>
<link href="/statics/front/css/center.css" rel="stylesheet">
<style>
.query{ margin:40px auto 60px auto;font-size: 14px; font-weight:normal;}
.query h2{font-size: 18px; font-weight:normal; line-height:32px; background-color:#f2f2f2;}
.query-table{margin:10px auto 20px auto; padding:10px 0;}
.query-table td{ padding:8px 5px; border-bottom:1px solid #ccc;}
</style>
</head>
<body>
<?php include THEMES_PATH.'public/header2.phtml'; ?>
<div class="main-width query">
<div class="clearfix user-center-head">
  <strong class="pull-left normal"><?php echo L('ordersn');?>: <?php echo $order['order_sn']; ?></strong>
  <?php if ($order['payment_status'] == OrderModel::PAY_UNPAYED && in_array($order['order_status'], array(OrderModel::ORDER_UNCONFIRMED ,OrderModel::ORDER_CONFIRMED))): ?>
  <a href="<?php echo url('order/order_edit','oid='.$order['id']);?>" class="pull-right btn"><?php echo L('editorderinfo');?></a>
  <?php endif;?>
</div>
<?php $orderInfo = $order; ?>
<!--订单状态-->
<div class="order-status">
  <?php
    $step = 0;
    if($orderInfo['start_time']){
    	if($orderInfo['payment_time']){
    		$step = 1;
    		$orderInfo['shipping_action_time'] = M('orders_log')->where(array('order_id'=>$orderInfo['id'],'shipping_status'=>99))->getField('action_time');
    		if($orderInfo['shipping_time']){
    			if($orderInfo['end_time']){
    				$step = 4;
    			}else{
    				$step = 3;
    			}
    		}else{
    			if($orderInfo['shipping_action_time']) $step = 2;
    		}
    	}
    }
  ?>
  <ul class="clearfix status-diagram">
    <li class="current">
      <i class="circle"></i>
      <span class="bar"></span>
      <i class="triangle-right"></i>
    </li>
    <li<?php if($step >= 1):?> class="current"<?php endif;?>>
      <i class="circle"></i>
      <span class="bar"></span>
      <i class="triangle-right"></i>
    </li>
    <li<?php if($step >= 2):?> class="current"<?php endif;?>>
      <i class="circle"></i>
      <span class="bar"></span>
      <i class="triangle-right"></i>
    </li>
    <li<?php if($step >= 3):?> class="current"<?php endif;?>>
      <i class="circle"></i>
      <span class="bar"></span>
      <i class="triangle-right"></i>
    </li>
    <li class="last<?php if($step >= 4):?> current<?php endif;?>">
      <i class="circle"></i>
    </li>
  </ul>
  <ul class="clearfix">
    <?php if($orderInfo['order_status'] == OrderModel::ORDER_CANCELED): ?>
    <li>
      <div><?php echo L('_cancelled_');?></div>
      <div><?php echo date('Y-m-d',$orderInfo['update_time']);?></div>
      <div><?php echo date('H:i:s',$orderInfo['update_time']);?></div>
    </li>
    <?php else: ?>
    <li>
      <div><?php echo L('completed_order');?></div>
      <div><?php echo date('Y-m-d',$orderInfo['start_time']);?></div>
      <div><?php echo date('H:i:s',$orderInfo['start_time']);?></div>
    </li>
    <?php endif; ?>
    <li>
      <div><?php echo L('_PAY_PAYED_');?></div>
      <?php if($orderInfo['payment_time']):?>
      <div><?php echo date('Y-m-d',$orderInfo['payment_time']);?></div>
      <div><?php echo date('H:i:s',$orderInfo['payment_time']);?></div>
      <?php endif;?>
    </li>
    <li>
      <div><?php echo L('making');?></div>
      <?php if($orderInfo['shipping_action_time']):?>
      <div><?php echo date('Y-m-d',$orderInfo['shipping_action_time']);?></div>
      <div><?php echo date('H:i:s',$orderInfo['shipping_action_time']);?></div>
      <?php endif;?>
    </li>
    <li>
      <div><?php echo L('_SHIPPING_SHIPPED_');?></div>
      <?php if($orderInfo['shipping_time']):?>
      <div><?php echo date('Y-m-d',$orderInfo['shipping_time']);?></div>
      <div><?php echo date('H:i:s',$orderInfo['shipping_time']);?></div>
      <?php endif;?>
    </li>
    <li class="last">
      <div><?php echo L('_ACCOUNT_COMPLETED_');?></div>
      <?php if($orderInfo['end_time']):?>
      <div><?php echo date('Y-m-d',$orderInfo['end_time']);?></div>
      <div><?php echo date('H:i:s',$orderInfo['end_time']);?></div>
      <?php endif;?>
    </li>
  </ul>
</div>
<!--收货人信息-->
<div class="user-center-head"><?php echo L('consignee');?></div>
<div class="consigneeinfo">
<div><?php echo isset($order['delivery_first_name']) ? $order['delivery_first_name'] : ''; ?>,<?php echo isset($order['delivery_last_name']) ? $order['delivery_last_name'] : ''; ?>/<?php echo isset($order['delivery_address']) ? $order['delivery_address'] : ''; ?>,<?php echo isset($order['delivery_city']) ? $order['delivery_city'] : ''; ?>,<?php echo isset($order['delivery_province']) ? $order['delivery_province'] : ''; ?>,<?php echo isset($order['delivery_country']) ? $order['delivery_country'] : ''; ?>/<?php echo isset($order['delivery_phone']) ? $order['delivery_phone'] : ''; ?></div>
<div><?php echo isset($order['delivery_email']) ? $order['delivery_email'] : ''; ?>/<?php echo isset($order['delivery_postcode']) ? $order['delivery_postcode'] : ''; ?></div>
</div>
<div class="user-center-head"><?php echo L('remark');?></div>
<div class="consigneeinfo">
  <?php echo isset($order['remark']) ? $order['remark'] : ''; ?>
</div>
<!--配送支付方式-->
<div class="user-center-head"><?php echo L('shipandpayment');?></div>
<div class="ml1x mb2x order-payment">
  <?php echo L('shippingmethod');?>:
  <span><?php echo isset($order['shipping_method_name']) ? $order['shipping_method_name'] : null; ?>
  (<?php echo $order['shipping_method'];?><?php echo !empty($order['shipping_no']) ? ':'.$order['shipping_no'] : '';?>)
  </span>
  <?php echo L('payment');?>:
  <span><?php echo isset($order['payment_method_name']) ? $order['payment_method_name'] : null; ?></span>
</div>
<?php if(isset($order['productList']) && $order['productList']):?>
<table class="mb2x order-goods">
  <tr>
    <th width="20%"><?php echo L('product_image');?></th>
    <th width="30%"><?php echo L('order_goods');?></th>
    <th width="10%"><?php echo L('goods_price');?></th>
    <th width="10%"><?php echo L('goods_number');?></th>
    <th width="20%"><?php echo L('minortotal');?></th>
	  <th width="10%"><?php echo L('figure_data');?></th>
  </tr>
  <?php
  if (isset($order['productList'])):
    foreach ($order['productList'] as $k => $product):
      if(in_array($product['product_id'],$order_down_product))
        $product['display'] = 0;
      else
        $product['display'] = 1;
  ?>
  <tr <?php if($product['display']==0):?>class="sold-out"<?php endif;?>>
    <td align="center"><img src="<?php echo $product['small_img'] ?>" alt="goods image" width="50" height="50" /></td>
    <td align="center"><a href="<?php echo url('product/'.$product['product_id'].'-'.generateUrl_un($product['product_name']));?>"><?php echo $product['product_name'] ?></a></td>
    <?php if($product['display'] == 0 ):?>
        <td align="center" colspan="4"><?php echo L('SOLD_OUT')?><!--sold out--></td>
    <?php  else:?>
        <td align="center"><?php echo currency(($product['total_amount']-$product['pants_price']*$product['pants_qty'])/$product['qty']);?></td>
        <td align="center"><?php echo $product['qty'] ?></td>
        <td align="center"><?php echo currency($product['total_amount']-$product['pants_price']*$product['pants_qty']);?></td>
        <td align="center">
        <?php if($product['measure_id']):?>
            <?php
            $measureInfo = AttributeModel::get_user_measure_info($product['measure_id']);
              if($measureInfo['m_status'] == 5):
            ?>
              <p>
              <?php foreach(unserialize($measureInfo['measure_data']) as $mskey=>$msval):?>
              <?php echo MeasureModel::msizedataShow($mskey);?>:<strong class="text-bold"><?php echo $msval;?></strong><br />
              <?php endforeach;?>
              </p>
            <?php else:?>
              <?php echo $measureInfo['measure_name'];?>
            <?php endif;?>
        <?php endif;?>
        </td>
    <?php endif;?>
  </tr>
	<?php if($product['pants_qty'] > 0): ?>
  <tr>
    <td></td>
    <td><?php echo L('AdditionalPants'); ?></td>
    <td><?php echo currency($product['pants_price']);?></td>
    <td><?php echo $product['pants_qty'] ?></td>
    <td><?php echo currency($product['pants_price']*$product['pants_qty']);?></td>
    <td></td>
  </tr>
  <?php endif;?>
  <?php
    endforeach;
    endif;
  ?>
</table>
<div class="user-center-head"><?php echo L('cost_information');?> »</div>
<table width="100%" cellpadding="0" cellspacing="0"  class="query-table">
  <tr>
    <td align="right"><?php echo L('le_montant_total');?>: <?php echo isset($order['product_amount']) ? currency($order['product_amount']) : ''; ?>
        + 运费: <?php echo currency($order['shipping_fee']);?>
        <?php if($order['payment_fee']){?> + 附加费: <?php echo currency($order['payment_fee']);?><?php }?>
    </td>
  </tr>
  <tr>
    <td align="right"><?php if($order['surplus_money']){?>
      - <?php echo L('usebalance');?>:<?php echo currency($order['surplus_money']);?><br>
      <?php }?>
      <?php if(floatval($order['integral_money'])){?>
      - <?php echo L('pointstopay');?> : <?php echo currency($order['integral_money']);?><br>
      <?php }?>
      <?php if(floatval($order['discount_count'])){?>
      - <?php echo L('order_discount');?>: <?php echo currency($order['discount_count']);?><br>
      <?php }?></td>
  </tr>
  <tr>
    <td align="right"><?php echo L('order_to_pay_amount');?>:
      <?php if (isset($order['pay_amount'])) echo currency($order['pay_amount']);?></td>
  </tr>
</table>
<?php endif;?>
<div style=" width:200px; margin:0 auto 20px auto;"><?php if(isset($paymentSubmit) && $paymentSubmit)echo $paymentSubmit;?></div></div>
</div>
<?php include THEMES_PATH.'public/footer2.phtml'; ?>
<?php include THEMES_PATH.'public/after_body.phtml'; ?>